<?php
/**
 * <b>RUBIK IT Solution & Development ltd.</b>
 *
 * PROJECT		: Rubik Ultimate Framework
 * @version 	: 1.1
 * COPYRIGHT    : 2008
 * ------------------------------------------------------
 * 
 * Created on	:  Jul 18, 2008
 * 
 */

// no direct access
defined ( '_FW_EXEC' ) or die ( 'Restricted access' );

class HtmlEditor {
	
	var $_name;
	function __construct($name) {
		$this->_name = $name;
		if (! function_exists ( 'version_compare' ) || version_compare ( phpversion (), '5', '<' ))
			include_once (SYS_LIB_PATH . 'editor' . DS . 'fckeditor_php4.php');
		else
			include_once (SYS_LIB_PATH . 'editor' . DS . 'fckeditor_php5.php');
	}
	
	function createEditor($value, $width = null, $height = null, $toolBar=null) {
		
		$oFCKeditor = new FCKeditor ( $this->_name );
		if ($width) {
			$oFCKeditor->Width = $width;
		}
		
		if ($height) {
			$oFCKeditor->Height = $height;
		}
		
		if ($toolBar) {
			$oFCKeditor->ToolbarSet = $toolBar;
		}
		
		$oFCKeditor->Value = $value;
		$oFCKeditor->BasePath = SYS_ROOT_URL . 'libraries/editor/';
		$oFCKeditor->CreateHtml ();
		return $oFCKeditor->CreateHtml ();
	}
}

?>